package sfs

import (
	"github.com/chicken-team-outside/chicken_transmission/api_messages"
	"io/fs"
	"os"
	"time"
)

type FileInfo struct {
	*api_messages.FileInfo
}

func NewFileInfo(info *api_messages.FileInfo) *FileInfo {
	return &FileInfo{FileInfo: info}
}

func (d FileInfo) Size() int64 {
	return d.FileInfo.Size
}

func (d FileInfo) Mode() fs.FileMode {
	return os.FileMode(d.FileInfo.Mode)
}

func (d FileInfo) ModTime() time.Time {
	return time.Unix(d.FileInfo.ModTime/1000, (d.FileInfo.ModTime%1000)*1000000)
}

func (d FileInfo) Sys() any {
	panic("implement me")
}

func (d FileInfo) Name() string {
	return d.FileInfo.Name
}

func (d FileInfo) IsDir() bool {
	return d.FileInfo.IsDir
}
